function! s:profile_cmd(func) abort
  " echom 'executing: '.a:func
  let start = reltime()
  
  call a:func()
  let elapsed = reltimefloat(reltime(start))
  echom 'In '.string(elapsed).' seconds'
  return elapsed
endfunction

function! CompareCmds(func1, func2) abort
  let elapsed1 = s:profile_cmd(a:func1)
  let elapsed2 = s:profile_cmd(a:func2)
  echom 'speedup: '.string(elapsed1 / elapsed2)
endfunction

func! VimLSplit() abort
  for i in range(1000000)
    call split("axabyasdfdsfsbsdzxvasfdasasab", "ab")
  endfor
endfunction

func! LuaSplit() abort
lua << EOF
  for i=1,1000000 do
    vim.split("axabyasdfdsfsbsdzxvasfdasasab", "ab")
  end
EOF
endfunction

let Func1 = function('VimLSplit')
let Func2 = function('LuaSplit')
call CompareCmds(Func1, Func2)
